package com.example.basic.reslut;

import com.example.basic.exception.CustomException;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class ExceptionResponse {

    /**
     * 错误码
     */
    private String code;
    /**
     * 错误信息
     */
    private String message;

    public static ExceptionResponse error(CustomException e) {
        ExceptionResponse response = new ExceptionResponse();
        response.setCode("999999");
        response.setMessage(e.getErrorMsg());
        return response;
    }
}
